package cn.shengchao.examstar.rpc.distribute.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 角色体系和分销角色绑定关系
 */
@Getter
@AllArgsConstructor
public enum SysRoleDistributeBindEnum {
    RB_MARKET_MANAGER(2L,"sr_scfx_scjl", DistributeSaleRoleEnum.ROLE_MKMG.getCode(),DistributeSaleRoleEnum.ROLE_MKMG.getDescription()),
    RB_MARKET_PROXY_MANAGER(3L,"sr_scfx_jms", DistributeSaleRoleEnum.ROLE_DSPD.getCode(),DistributeSaleRoleEnum.ROLE_DSPD.getDescription()),
    RB_MARKET_PROXY_EMPLOYEE(4L,"sr_scfx_jms_yg", DistributeSaleRoleEnum.ROLE_DSPD_EMP.getCode(),DistributeSaleRoleEnum.ROLE_DSPD_EMP.getDescription()),
    RB_MARKET_MEMBER(8L,"sr_scfx_slmb", DistributeSaleRoleEnum.ROLE_SLMB.getCode(),DistributeSaleRoleEnum.ROLE_SLMB.getDescription()),
    RB_CONTENT_MANAGER(5L,"sr_nrfx_jms", DistributeContentRoleEnum.ROLE_CTPD.getCode(),DistributeContentRoleEnum.ROLE_CTPD.getDescription()),
    RB_CONTENT_EMPLOYEE(6L,"sr_nrfx_jms_yg", DistributeContentRoleEnum.ROLE_CTPD_EMP.getCode(),DistributeContentRoleEnum.ROLE_CTPD_EMP.getDescription()),
    ;
    private Long  sysRoleId;
    private String sysRoleCode;
    private String distributeCode;
    private String distributeName;

    public static SysRoleDistributeBindEnum getBySysRoleCode(String roleCode) {
        for (SysRoleDistributeBindEnum roleEnum : values()){
            if (roleEnum.getSysRoleCode().equals(roleCode)){
                return roleEnum;
            }
        }
        return null;
    }

    public static SysRoleDistributeBindEnum getByDistributeCode(String roleCode) {
        for (SysRoleDistributeBindEnum roleEnum : values()){
            if (roleEnum.getDistributeCode().equals(roleCode)){
                return roleEnum;
            }
        }
        return null;
    }
}
